﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T05//字符串
{
    class Program
    {
        static void Main(string[] args)
        {
            //拆分
            string str = "sa as io";
            string[] str1=str.Split(' ');
            Console.WriteLine($"{str}拆分后的第一段:{str1[1]}");
            Console.WriteLine("=====================");

            //规范
            string str2 = "aBx";
            string s2=str2.ToLower();
            Console.WriteLine($"{str2}转小写后{s2}");
            s2 = str2.ToUpper();
            Console.WriteLine($"{str2}转大写后{s2}");
            Console.WriteLine("=====================");
            //修改
            string str3 = "qwe123a";
            string s3 = str3.Substring(1, 2);
            Console.WriteLine($"{str3}截取后：{s3}");
            s3 = str3.Remove(1,2);
            Console.WriteLine($"{str3}删除后：{s3}");
            s3 = str3.Replace("123", "456");
            Console.WriteLine($"{str3}置换后：{s3}");
            s3 = str3.Insert(2,"00");
            Console.WriteLine($"{str3}插入后：{s3}");
            Console.WriteLine("=====================");
            //比较
            string str4 = "abc", s4 = "ABC";
            int a=s4.CompareTo(str4);
            Console.WriteLine($"{str4}与{s4}比较结果：{a}");
            Console.WriteLine("=====================");
            //查找
            string str5 = "qwerty";
            bool b = str5.Contains('q');
            Console.WriteLine($"{str5}查找结果：{b}");
            Console.WriteLine("=====================");
            //格式化
            int x = 4, y = 5;
            string str6 = string.Format("{0}月{1}日", x, y);
            Console.WriteLine($"{x},{y}格式化后：{str6}");
            Console.WriteLine("=====================");
            Console.ReadKey();
        }
    }
}
